const subscribeApi = {
    /**
     * 订阅账单列表
     *
     * @returns {Promise<SubscribeBillingResponse[]>}
     * @author zero
     */
    billing(): Promise<SubscribeBillingResponse[]> {
        return $request.get<SubscribeBillingResponse[]>({
            url: '/subscribe/billing'
        })
    },

    /**
     * 订阅套餐列表
     *
     * @param {string} [calendar] - 日历类型
     * @returns {Promise<SubscribePackageResponse>}
     * @author zero
     */
    package(calendar?: string): Promise<SubscribePackageResponse> {
        return $request.get<SubscribePackageResponse>({
            url: '/subscribe/package',
            params: {
                calendar
            }
        })
    },

    /**
     * 订阅记录列表
     *
     * @returns {Promise<SubscribeRecordResponse[]>}
     * @author zero
     */
    record(): Promise<SubscribeRecordResponse[]> {
        return $request.get<SubscribeRecordResponse[]>({
            url: '/subscribe/record'
        })
    },

    /**
     * 订阅套餐下单
     *
     * @param {Object} params
     * @param {number} params.package_id - 套餐ID
     * @returns {Promise<SubscribePlaceResponse>}
     * @author zero
     */
    place(params: {
        package_id: number;
    }): Promise<SubscribePlaceResponse> {
        return $request.post({
            url: '/subscribe/place',
            params
        })
    }
}

export default subscribeApi